<!DOCTYPE html>
<html>
	<head>
		<title></title>
	</head>
	<body>
		<script>
		var num=prompt("请输入一个正整数：");
		sum=0;
		while(num)
		{
		var ge=num%10;  
		document.write(ge);
		num=(num-ge)/10; 
		sum=sum+ge;
		}
		document.write("<br>"+"各位数之和为："+sum);
		</script>
		
		
			
		
		
	</body>
</html>